<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: order_details_crossselling.php 135 2013-09-22 07:30:55Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 135 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-22 07:30:55 +0000 (Sun, 22 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright © since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	© 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	© 2002-2003 osCommerce - www.oscommerce.com
* 	© 2003     neommerce - www.neommerce.org
* 	© 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

$cart_p_ids = array();
for($i = 0, $n = sizeof($products); $i < $n; $i ++) {
	$pID = get_prid($products[$i]['id']);
	if(!in_array($pID, $cart_p_ids))
		$cart_p_ids[] = $pID;
}

$xsell = $db->db_query("SELECT DISTINCT
							p.products_fsk18,
							p.products_tax_class_id,
							p.products_id,
							p.products_quantity,
							p.products_image,
							p.products_list_overlay,
							pd.products_img_alt,
							pd.products_name,
							pd.products_short_description,
							p.products_fsk18,p.products_price,p.products_vpe,
							p.products_vpe_status,
							p.products_vpe_value,
							xp.sort_order
						FROM
							".TABLE_PRODUCTS_XSELL." xp, 
							".TABLE_PRODUCTS." p, 
							".TABLE_PRODUCTS_DESCRIPTION." pd
						WHERE
							p.products_id = xp.xsell_id
						AND
							xp.products_id IN ('".implode("','", $cart_p_ids)."')
							".$product->groupCheck().$product->fsk18()."
						AND
							p.products_id = pd.products_id
						AND
							pd.language_id = '".$_SESSION['languages_id']."'
						AND
							p.products_status = '1'
						ORDER BY
							xp.sort_order ASC", true);

if($xsell->_numOfRows) {
	$cart_crosssell_smarty = new Smarty();
	$cart_cross_sell_data = array();
	$list_data = get_list_data('cart_cross_selling');
	
	$row = 0;
	while(!$xsell->EOF) { $row++;
		$cart_cross_sell_data[] = $product->buildDataArray($xsell->fields, 'thumbnail', $list_data, $row);
		$xsell->MoveNext();
	}
	
	$cart_crosssell_smarty->assign('TITLE', 'Das könnte Sie noch interessieren');
	if($list_data['col']>1)
		$cart_crosssell_smarty->assign('CLASS_NAME', 'grid');
	else
		$cart_crosssell_smarty->assign('CLASS_NAME', 'list');
	$cart_crosssell_smarty->assign('LIST_NAME', 'cart_crosselling');
	
	$cart_crosssell_smarty->assign('language', $_SESSION['language']);
	$cart_crosssell_smarty->assign('module_content', $cart_cross_sell_data);
	$cart_crosssell_smarty->caching = false;
	$module = $cart_crosssell_smarty->fetch(CURRENT_TEMPLATE.'/module/product_listings.html');
	$module_smarty->assign('crossselling_cart', $module);
}